<template>
  <div class="wrapper">
    <div id="r3" style="width: 100%; height: 100%"></div>
  </div>
</template>

<script>
import * as echarts from "echarts";
export default {
  name: "rightthree",
  mounted() {
    this.getList();
  },
  methods: {
    getList() {
      // 基于准备好的dom，初始化echarts实例
      const chartDom = document.getElementById("r3");
      const myChart = echarts.init(chartDom);
     window.addEventListener("resize", function () {
        myChart.resize();
      });
      var option = {
        title: {
          text: "大洲感染人数饼状图",
          left: "center",
          textStyle: {
            color: "#fff",
            fontSize: "18",
          },
        },

        color: [
          "#7eacea",
          "#e15777",
          "#95ea71",
          "#ea9b4f",
          "#7577df",
          "#be72d8",
          "#fff",
        ],
        tooltip: {
          trigger: "item",
          formatter: "{a} <br/>{b} : {c} ({d}%)",
        },
        series: [
          {
            name: "统计",
            type: "pie",
            radius: [10, 80],
            center: ["50%", "60%"],
            roseType: "radius",
            label: {
              show: true,
              formatter: "{d}%",
            },
            emphasis: {
              label: {
                show: true,
              },
            },
            data: [
              {
                value: 25,
                name: "rose1",
              },
              {
                value: 20,
                name: "rose2",
              },
              {
                value: 15,
                name: "rose3",
              },
              {
                value: 10,
                name: "rose4",
              },
              {
                value: 8,
                name: "rose5",
              },
              {
                value: 3,
                name: "rose6",
              },
            ],
          },
          {
            name: "占位",
            // type: "pie",
            silent: true,
            center: ["50%", "50%"],
            radius: 30,
            hoverAnimation: false,
            label: {
              show: false,
              position: "center",
            },
            data: [
              {
                value: 1,
                name: "占位2",
              },
            ],
            itemStyle: {
              normal: {
                color: "#fff",
                shadowColor: "rgba(0, 0, 0, 0.5)",
                shadowBlur: 10,
              },
            },
          },
        ],
      };

      myChart.setOption(option);
    },
  },
};
</script>

<style lang="scss" scoped>
.wrapper {
  width: 100%;
  height: 100%;
}
</style>